<template>
  <div class="advertise1">
    <a
      v-for="(item, index) in arr"
      :key="index"
      class="box"
      :href="item.url"
      target="_blank"
    >
      <img :src="item.img" alt="" class="img1" />
      <span>{{item.text}}</span>
    </a>
    <div class="rightbot">
      <span @click="toadvertise()">广告</span>
      <span class="el-icon-close" @click="fguanbi()" ref="guanbi"> </span>
    </div>
  </div>
</template>

<script>
export default {
  props:["arr"],
  methods: {
    fguanbi() {
      this.$refs.guanbi.parentNode.parentNode.remove();
    },
  },
};
</script>

<style scoped lang="scss">
.advertise1 {
  width: 292px;
  display: flex;
  flex-wrap: wrap;
  padding-left: 5px;
  padding-top: 5px;
  position: relative;
  margin-bottom: 50px;
  .box {
    display: block;
    width: 140px;
    margin-bottom: 5px;
    margin-right: 5px;
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    .img1 {
      width: 140px;
      height: 100px;
      border: 1px solid #eee;
    }
  }
  .box:hover {
    color: red;
  }
  .box:hover .img1 {
    border-color: red;
  }
}
.rightbot {
  position: absolute;
  right: 5px;
  bottom: 2px;
  padding: 2px 2px 0 4px;
  display: flex;
  font-size: 12px;
  height: 16px;
  line-height: 16px;
  background-color: rgb(223, 217, 217, 0.8);
  color: #777;
  cursor: pointer;
  .el-icon-close {
    font-size: 13px;
    line-height: 16px;
  }
}
</style>